import { createStore } from 'vuex'

export default createStore({
  state: {
    todoList:[],
  },
  mutations: {
    addTodo(state,todo){
      state.todoList.push(todo)
    },
    changeTodoState(state,index){
      state.todoList[index].state = state.todoList[index].state=='active'?'complete':'active'
    },
    delTodo(state,index){
      state.todoList.splice(index,1)
    }

  },
  actions: {
  },
  modules: {
  }
})
